package com.tairanchina.rabbit.producer;

import com.tairanchina.rabbit.entity.User;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.xml.bind.helpers.AbstractMarshallerImpl;

/**
 * Created by lxliuxuan on 2016/11/24.
 */
@Component
public class Producer {
    @Autowired
    @Qualifier("amqpTemplate")
    private AmqpTemplate rabbitTemplate;
    public void sendData(String quequKey,User user){
        rabbitTemplate.convertAndSend(quequKey,user);
       /* rabbitTemplate.send(quequKey,new Message("nihao".getBytes(),new MessageProperties()));*/
    }
}
